home *** CD-ROM | disk | FTP | other *** search
Text File | 2008-06-10 | 43.7 KB | 1,504 lines |
- #define RSD3D_FALLBACKMODE
-
- #include "RsD3DMaterialFromME2_BaseInclude.fx"
-
- //----------------------------------------------------------------------
- //Fallback (vanilla ps2.0, ps1.4, ps1.1 and fixed pipeline) emulation
- //
- //Author - Michal Valient
- //Copyright (C) 2004-2008 Caligari corporation
- //
- //----------------------------------------------------------------------
-
-
-
- //------------------------------
- //Fallback parameters start here
- //------------------------------
-
- //Global parameters
- uniform float RsD3DMaterialFromME_fNormalMod = 1.0f;
- uniform float RsD3DMaterialFromME_fOpacity = 1.0f;
-
- uniform float4 RsD3DMaterialFromME_cOverlayMod = { 0.0f, 0.0f, 0.0f, 1.0f };
-
- //Diffuse color parameters
- //Final diffuse color is computed using this equation
- //DiffuseColor = VertexColor * RsFALL_VertexColorStrength + RsFALL_DiffuseColor + RsFALL_DiffuseMapStrength * RsFALL_DiffuseMap
- texture RsFALL_DiffuseMap : DIFFUSEMAP;
- float4 RsFALL_DiffuseColor : DIFFUSECOLOR = float4(0.0f, 0.0f, 0.0f, 0.0f);
- float RsFALL_DiffuseMapStrength : DIFFUSEMAPSTRENGTH = 0.0f;
- float RsFALL_VertexColorStrength : VERTEXCOLORSTRENGTH = 1.0f;
-
- texture RsFALL_NormalMap : NORMALMAP;
- float4 RsFALL_SpecularColor : SPECULARCOLOR = float4(1.0f, 1.0f, 1.0f, 1.0f);
- float RsFALL_Shininess : SHININESS = 30.0f;
- float RsFALL_SpecularStrength : SPECULARSTRENGTH = 0.0f;
- float RsFALL_DiffuseStrength : DIFFUSESTRENGTH = 1.0f;
-
- //------------------------------
- //Texture coordinates processing
- // - for color texture
- float RsFALL_C_TCScaleX : C_TCSCALEX = 1.0;
- float RsFALL_C_TCScaleY : C_TCSCALEY = 1.0;
- float RsFALL_C_TCMoveX : C_TCMOVEX = 0.0;
- float RsFALL_C_TCMoveY : C_TCMOVEY = 0.0;
-
- // - for normal map
- float RsFALL_N_TCScaleX : N_TCSCALEX = 1.0;
- float RsFALL_N_TCScaleY : N_TCSCALEY = 1.0;
- float RsFALL_N_TCMoveX : N_TCMOVEX = 0.0;
- float RsFALL_N_TCMoveY : N_TCMOVEY = 0.0;
-
- //------------------------------
- //Light processing - only omni lights are supported
- float4 RsFALL_LightPos : LIGHTPOSITION = float4(0.0, 0.0, 0.0, 1.0);
- float4 RsFALL_LightColor : LIGHTCOLOR = float4(1.0, 1.0, 1.0, 1.0);
- float RsFALL_LightAttenA : LIGHTATTENA = 0.005;
- float RsFALL_LightAttenB : LIGHTATTENB = 0.0;
- float RsFALL_LightAttenC : LIGHTATTENC = 1.0;
-
- //------------------------------
- //PS 1.4 Specular maps
- //
- texture RsFALL_PS14SpecularMap : RsFALL_PS14SpecularMap;
-
- sampler RsFALL_smplDiffuse = sampler_state {
- Texture = <RsFALL_DiffuseMap>;
-
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- MipFilter = LINEAR;
-
- AddressU = WRAP;
- AddressV = WRAP;
- };
-
- sampler RsFALL_smplNormal = sampler_state {
- Texture = <RsFALL_NormalMap>;
-
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- MipFilter = LINEAR;
-
- AddressU = WRAP;
- AddressV = WRAP;
- };
-
- sampler RsFALL_smplSpecular = sampler_state {
- Texture = <RsFALL_PS14SpecularMap>;
-
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- MipFilter = LINEAR;
-
- AddressU = CLAMP;
- AddressV = CLAMP;
- };
-
- float3x3 RsD3DComputeTangentTransform(float3 vTangent, float3 vNormal, in float3x3 mToWorld)
- {
- float3x3 mToTangent;
- mToTangent[0] = normalize(mul(vTangent * RsD3DMaterialFromME_fNormalMod, mToWorld));
- mToTangent[2] = normalize(mul(vNormal * RsD3DMaterialFromME_fNormalMod, mToWorld));
- mToTangent[1] = cross(mToTangent[0], mToTangent[2]);
- return mToTangent;
- }
-
- float2 RsD3DComputeColorTexCoords(float2 vInputCoords)
- {
- float2 vRetVal = vInputCoords;
- vRetVal.x = vInputCoords.x * RsFALL_C_TCScaleX + RsFALL_C_TCMoveX;
- vRetVal.y = vInputCoords.y * RsFALL_C_TCScaleY + RsFALL_C_TCMoveY;
- return vRetVal;
- }
-
- float2 RsD3DComputeNormalTexCoords(float2 vInputCoords)
- {
- float2 vRetVal = vInputCoords;
- vRetVal.x = vInputCoords.x * RsFALL_N_TCScaleX + RsFALL_N_TCMoveX;
- vRetVal.y = vInputCoords.y * RsFALL_N_TCScaleY + RsFALL_N_TCMoveY;
- return vRetVal;
- }
-
- float4 RsD3DComputeLightColor(float fDistToLight)
- {
- float fAttenuation = RsFALL_LightAttenA * fDistToLight * fDistToLight + RsFALL_LightAttenB * fDistToLight + RsFALL_LightAttenC;
- return RsFALL_LightColor * saturate(1.0f / fAttenuation);
- }
-
- //------------------------------
- // This is a fallback code for PS 2.0 hardware
- // We do per pixel diffuse and per pixel specular
- //------------------------------
- struct VS_OUTPUT_PS20 {
- float4 vClipPos : POSITION; //Clipping space position
- float2 tcCoordC : TEXCOORD0; //texture coordinates
- float2 tcCoordN : TEXCOORD1; //texture coordinates
- float3 vLight : TEXCOORD2; //light vector
- float3 vEye : TEXCOORD3; //eye vector
- float4 vDistToLight : TEXCOORD4; //distance from light
- float4 cVertexColor : TEXCOORD5; //vertex color
- };
-
- VS_OUTPUT_PS20 VS_Fallback_ForPS20HW(in D3_VERTEXINPUT input)
- {
- VS_OUTPUT_PS20 output;
-
- //Following code outputs position and texture coordinates
- //------------------------------
- output.vClipPos = mul(input.D3_pInputPosition, D3_mObjectToClip); //vertex clip position
- output.tcCoordC = RsD3DComputeColorTexCoords(input.D3_vInputTexCoords1); //Texture coordinates for color texture
- output.tcCoordN = RsD3DComputeNormalTexCoords(input.D3_vInputTexCoords2); //Texture coordinates for normal texture
-
- float4 pVertexWorld = mul(input.D3_pInputPosition, D3_mObjectToWorld); //Transform vertex into world position
- float3x3 mToTangent = RsD3DComputeTangentTransform(input.D3_vInputTangent, input.D3_vInputNormal, D3_mObjectToWorldN);
-
- //Compute light and eye vectors
- //------------------------------
- float3 vToLight = RsFALL_LightPos.xyz - pVertexWorld.xyz;
- output.vLight = mul(mToTangent, normalize(vToLight));
- output.vDistToLight = length(vToLight);
-
- float3 vToEye = normalize(D3_pEye - pVertexWorld);
- output.vEye = mul(mToTangent, vToEye);
-
- output.cVertexColor = input.D3_cInputColor * RsFALL_VertexColorStrength + RsFALL_DiffuseColor;
-
- return output;
- }
-
- float4 PS_Fallback_ForPS20HW(uniform bool EnableAlpha, uniform bool IsFirstPass, in VS_OUTPUT_PS20 input) : COLOR0
- {
- float4 cDecal = tex2D(RsFALL_smplDiffuse, input.tcCoordC);
- float3 cNormal = tex2D(RsFALL_smplNormal, input.tcCoordN).xyz;
- float3 vNormal = normalize(2.0f * cNormal - 1.0f); //expand to the range -1,1
- float3 vEye = normalize(input.vEye);
- float3 vLight = normalize(input.vLight);
-
- float4 cLightColor = RsD3DComputeLightColor(input.vDistToLight.w);
-
- float3 vRefVec = dot(vLight, vNormal) * 2.0f * vNormal - vLight;
- float fEyeDotRef = max(0, dot(vRefVec, vEye));
- float4 cSpecularCol = RsFALL_SpecularColor * pow(fEyeDotRef, RsFALL_Shininess);
-
- float fDiffuseDot = saturate(dot(vNormal, vLight));
- float4 diffuseColor = input.cVertexColor + RsFALL_DiffuseMapStrength * cDecal;
- float4 cOut = cLightColor * (cSpecularCol * RsFALL_SpecularStrength + diffuseColor * fDiffuseDot * RsFALL_DiffuseStrength);
- if (EnableAlpha)
- cOut.a = RsD3DMaterialFromME_fOpacity;
-
- ///Add the overlay color
- if (IsFirstPass)
- {
- ///First pass performs complete blending.
- cOut.xyz = RsD3DMaterialFromME_cOverlayMod.xyz + RsD3DMaterialFromME_cOverlayMod.a * cOut.xyz;
- }
- else
- {
- ///All other passes just attenuate the lighting accordingly.
- cOut.xyz = RsD3DMaterialFromME_cOverlayMod.a * cOut.xyz;
- }
- return cOut;
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS20
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "75";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_2_0 VS_Fallback_ForPS20HW();
- PixelShader = compile ps_2_0 PS_Fallback_ForPS20HW(false, true);
-
- AlphaBlendEnable = false;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS20_MORELIGHTS
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "75";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_2_0 VS_Fallback_ForPS20HW();
- PixelShader = compile ps_2_0 PS_Fallback_ForPS20HW(false, false);
-
- AlphaBlendEnable = true;
- SrcBlend = ONE;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS20_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "75";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_2_0 VS_Fallback_ForPS20HW();
- PixelShader = compile ps_2_0 PS_Fallback_ForPS20HW(true, true);
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = INVSRCALPHA;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS20_MORELIGHTS_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "75";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_2_0 VS_Fallback_ForPS20HW();
- PixelShader = compile ps_2_0 PS_Fallback_ForPS20HW(true, false);
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- //------------------------------
- // This is a fallback code for PS 1.4 hardware
- // We do per pixel diffuse and per pixel specular. Attenuation is computed per vertex.
- //------------------------------
- struct VS_OUTPUT_PS14 {
- float4 vClipPos : POSITION; //Clipping space position
- float2 tcCoordC : TEXCOORD0; //texture coordinates
- float2 tcCoordN : TEXCOORD1; //texture coordinates
- float3 vLight : TEXCOORD2; //light vector
- float3 vEye : TEXCOORD3; //eye vector
- float4 fShininess : TEXCOORD4; //Shininess transfer
- float4 cLightColor : COLOR1; //light color with attenuation
- float4 cVertexColor : COLOR0; //vertex color
- };
-
- VS_OUTPUT_PS14 VS_Fallback_ForPS14HW(in D3_VERTEXINPUT input)
- {
- VS_OUTPUT_PS14 output;
-
- //Following code outputs position and texture coordinates
- //------------------------------
- output.vClipPos = mul(input.D3_pInputPosition, D3_mObjectToClip); //vertex clip position
- output.tcCoordC = RsD3DComputeColorTexCoords(input.D3_vInputTexCoords1); //Texture coordinates for color texture
- output.tcCoordN = RsD3DComputeNormalTexCoords(input.D3_vInputTexCoords2); //Texture coordinates for normal texture
-
- float4 pVertexWorld = mul(input.D3_pInputPosition, D3_mObjectToWorld); //Transform vertex into world position
- float3x3 mToTangent = RsD3DComputeTangentTransform(input.D3_vInputTangent, input.D3_vInputNormal, D3_mObjectToWorldN);
-
- //Compute light and eye vectors
- //------------------------------
- float3 vToLight = RsFALL_LightPos.xyz - pVertexWorld.xyz;
- float fRealDistToLight = length(vToLight);
- vToLight = normalize(vToLight);
- output.vLight = mul(mToTangent, vToLight);
-
- float3 vToEye = normalize(D3_pEye - pVertexWorld);
- output.vEye = mul(mToTangent, vToEye);
-
- ///We do overlay multiplication here
- output.cLightColor = RsD3DMaterialFromME_cOverlayMod.a * RsD3DComputeLightColor(fRealDistToLight);
-
- output.cVertexColor = input.D3_cInputColor * RsFALL_VertexColorStrength + RsFALL_DiffuseColor;
- output.fShininess = RsFALL_Shininess / 100.0f;
-
- return output;
- }
-
- float4 PS_Fallback_ForPS14HW(uniform bool EnableAlpha, uniform bool IsFirstPass, in VS_OUTPUT_PS14 input) : COLOR0
- {
- float4 cDecal = tex2D(RsFALL_smplDiffuse, input.tcCoordC);
- float3 cNormal = tex2D(RsFALL_smplNormal, input.tcCoordN).xyz;
- float3 vNormal = 2.0f * cNormal - 1.0f;
- float3 vLight = input.vLight;
-
- float fNdotL = dot(vLight, vNormal);
- float4 diffuseColor = input.cVertexColor + RsFALL_DiffuseMapStrength * cDecal;
-
- //Specular term
- float3 vEye = input.vEye;
- float3 vRefVec = 2.0f * fNdotL * vNormal - vLight;
- float2 vCoord = input.fShininess;
- vCoord.x = dot(vEye, vRefVec);
- float4 cSpecularTerm = tex2D(RsFALL_smplSpecular, vCoord);
- float4 cSpecularCol = RsFALL_SpecularColor * cSpecularTerm.a;
-
- float4 cOut;
- cOut = input.cLightColor * (cSpecularCol * RsFALL_SpecularStrength + diffuseColor * saturate(fNdotL) * RsFALL_DiffuseStrength);
- if (EnableAlpha)
- cOut.a = RsD3DMaterialFromME_fOpacity;
-
- ///Add the overlay color
- if (IsFirstPass)
- {
- ///First pass performs complete blending.
- cOut = RsD3DMaterialFromME_cOverlayMod + cOut;
- }
- return cOut;
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS14
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "65";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS14HW();
- PixelShader = compile ps_1_4 PS_Fallback_ForPS14HW(false, true);
-
- AlphaBlendEnable = false;
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS14_MORELIGHT
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "65";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS14HW();
- PixelShader = compile ps_1_4 PS_Fallback_ForPS14HW(false, false);
-
- AlphaBlendEnable = true;
- SrcBlend = ONE;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS14_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "65";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS14HW();
- PixelShader = compile ps_1_4 PS_Fallback_ForPS14HW(true, true);
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = INVSRCALPHA;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS14_MORELIGHT_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "65";
- >
- {
- pass D3_FALLBACK_PASS_02_PS20
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS14HW();
- PixelShader = compile ps_1_4 PS_Fallback_ForPS14HW(true, false);
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- //------------------------------
- // This is a fallback code for PS 1.1 hardware
- // We do per pixel diffuse and per vertex specular
- //------------------------------
- struct VS_OUTPUT_PS11 {
- float4 vClipPos : POSITION; //Clipping space position
- float4 cVertexColor : TEXCOORD3; //vertex color
- float4 cLightColor : COLOR1; //light color with attenuation
- float2 tcCoordC : TEXCOORD0;//texture coordinates
- float2 tcCoordN : TEXCOORD1;//texture coordinates
- float3 vLight : TEXCOORD2;//light vector
- float4 cSpecularCol : COLOR0; //complete specular color component
- };
-
- VS_OUTPUT_PS11 VS_Fallback_ForPS11HW(uniform bool EnableAlpha, in D3_VERTEXINPUT input)
- {
- VS_OUTPUT_PS11 output;
-
- //Following code outputs position and texture coordinates
- //------------------------------
- output.vClipPos = mul(input.D3_pInputPosition, D3_mObjectToClip); //vertex clip position
- output.tcCoordC = RsD3DComputeColorTexCoords(input.D3_vInputTexCoords1); //Texture coordinates for color texture
- output.tcCoordN = RsD3DComputeNormalTexCoords(input.D3_vInputTexCoords2); //Texture coordinates for normal texture
-
- float4 pVertexWorld = mul(input.D3_pInputPosition, D3_mObjectToWorld); //Transform vertex into world position
- float3x3 mToTangent = RsD3DComputeTangentTransform(input.D3_vInputTangent, input.D3_vInputNormal, D3_mObjectToWorldN);
-
- //Compute light and eye vectors
- //------------------------------
- float3 vToLight = RsFALL_LightPos.xyz - pVertexWorld.xyz;
- float fRealDistToLight = length(vToLight);
- vToLight = normalize(vToLight);
- output.vLight = mul(mToTangent, vToLight);
- output.vLight = 0.5 * output.vLight + 0.5;
-
- float3 vToEye = normalize(D3_pEye - pVertexWorld);
-
- float4 vLightColor = RsD3DComputeLightColor(fRealDistToLight);
-
- //Compute final per vertex color using
- //------------------------------
- float3 vRefVec = dot(vToLight, mToTangent[2]) * 2 * mToTangent[2] - vToLight;
- float fEyeDotRef = saturate(dot(vRefVec, vToEye));
-
- output.cSpecularCol = vLightColor * RsFALL_SpecularColor * pow(fEyeDotRef, RsFALL_Shininess) * RsFALL_SpecularStrength;
- output.cLightColor = vLightColor * RsFALL_DiffuseStrength;
- output.cVertexColor = (input.D3_cInputColor * RsFALL_VertexColorStrength + RsFALL_DiffuseColor) * output.cLightColor;
-
- if (EnableAlpha)
- output.cSpecularCol.a = RsD3DMaterialFromME_fOpacity;
- else
- output.cSpecularCol.a = 1.0f;
-
- return output;
- }
-
- float4 PS_Fallback_ForPS11HW(uniform bool IsFirstPass, in VS_OUTPUT_PS11 input) : COLOR0
- {
- float4 cDecal = tex2D(RsFALL_smplDiffuse, input.tcCoordC);
- float3 cNormal = tex2D(RsFALL_smplNormal, input.tcCoordN).xyz;
- float3 vNormal = 2.0f * cNormal - 1.0f; //expand to the range -1,1
- float3 vLight = 2.0f * saturate(input.vLight) - 1.0f; //expand to the range -1,1
- float fDiffuseDot = saturate(dot(vNormal, vLight));
- float3 diffuseMap = RsFALL_DiffuseMapStrength * cDecal;
- float4 cOut = input.cSpecularCol.a;
- cOut.xyz = input.cSpecularCol + (input.cVertexColor + input.cLightColor * diffuseMap) * fDiffuseDot;
-
- ///Add the overlay color
- if (IsFirstPass)
- {
- ///First pass performs complete blending.
- cOut.xyz = RsD3DMaterialFromME_cOverlayMod.xyz + RsD3DMaterialFromME_cOverlayMod.a * cOut.xyz;
- }
- else
- {
- ///All other passes just attenuate the lighting accordingly.
- cOut.xyz = RsD3DMaterialFromME_cOverlayMod.a * cOut.xyz;
- }
- return cOut;
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS11
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "45";
- >
- {
- pass D3_FALLBACK_PASS_02_PS11
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS11HW(false);
- PixelShader = compile ps_1_1 PS_Fallback_ForPS11HW(true);
-
- AlphaBlendEnable = false;
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS11_MORELIGHT
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "45";
- >
- {
- pass D3_FALLBACK_PASS_02_PS11
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS11HW(false);
- PixelShader = compile ps_1_1 PS_Fallback_ForPS11HW(false);
-
- AlphaBlendEnable = true;
-
- SrcBlend = ONE;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS11_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "45";
- >
- {
- pass D3_FALLBACK_PASS_02_PS11
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS11HW(true);
- PixelShader = compile ps_1_1 PS_Fallback_ForPS11HW(true);
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = INVSRCALPHA;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_PS11_MORELIGHT_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "45";
- >
- {
- pass D3_FALLBACK_PASS_02_PS11
- {
- VertexShader = compile vs_1_1 VS_Fallback_ForPS11HW(true);
- PixelShader = compile ps_1_1 PS_Fallback_ForPS11HW(false);
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- CullMode = CCW;
- }
- }
-
- //------------------------------
- // This is a fallback code for old DX7 hardware even without DOT3 capabilities
- // Entire lighting is computed per vertex and diffuse texture is used.
- //------------------------------
- struct VS_OUTPUT_SIMPLE_DX7 {
- float4 vClipPos: POSITION; //Clipping space position
- float2 tcCoord0: TEXCOORD0; //Texture coordinates
- float4 cColor0 : COLOR0; //diffuse map mod
- float4 cColor1 : COLOR1; //specular color + diffuse color mod
- };
-
- VS_OUTPUT_SIMPLE_DX7 VS_Fallback_Simple_DX7(uniform bool EnableAlpha, uniform bool IsFirstPass, in D3_VERTEXINPUT input)
- {
- VS_OUTPUT_SIMPLE_DX7 output;
-
- //Following code outputs position and texture coordinates
- //------------------------------
- output.vClipPos = mul(input.D3_pInputPosition, D3_mObjectToClip); //vertex clip position
- output.tcCoord0 = RsD3DComputeColorTexCoords(input.D3_vInputTexCoords1); //Texture coordinates for color texture
- float4 pVertexWorld = mul(input.D3_pInputPosition, D3_mObjectToWorld); //Transform vertex into world position
-
- //Compute light and eye vectors
- //------------------------------
- float3 vToLight = RsFALL_LightPos.xyz - pVertexWorld.xyz;
- float fRealDistToLight = length(vToLight);
- vToLight = normalize(vToLight);
-
- float3 vToEye = normalize(D3_pEye - pVertexWorld);
-
- float4 output_cLightColor = RsD3DComputeLightColor(fRealDistToLight);
-
- //Compute final per vertex color using light/specular/diffuse
- //------------------------------
- float3 vNormal = normalize(mul(input.D3_vInputNormal * RsD3DMaterialFromME_fNormalMod, D3_mObjectToWorldN));
- float3 vRefVec = dot(vToLight, vNormal) * 2 * vNormal - vToLight;
- float fEyeDotRef = max(0, dot(vRefVec, vToEye));
-
- float4 output_cSpecularCol = RsFALL_SpecularColor * pow(fEyeDotRef, RsFALL_Shininess);
- float4 output_cVertexColor = input.D3_cInputColor * RsFALL_VertexColorStrength + RsFALL_DiffuseColor;
-
- float fDiffuseDot = saturate(dot(vNormal, vToLight)) * RsFALL_DiffuseStrength;
- output.cColor0 = saturate(output_cLightColor * RsFALL_DiffuseMapStrength * fDiffuseDot);
- output.cColor1 = saturate(output_cLightColor * (output_cSpecularCol * RsFALL_SpecularStrength + (output_cVertexColor * fDiffuseDot)));
- if (EnableAlpha)
- {
- output.cColor0.a = RsD3DMaterialFromME_fOpacity;
- output.cColor1.a = 0;
- }
-
- ///Add the overlay color
- if (IsFirstPass)
- {
- ///First pass performs complete blending.
- output.cColor0.xyz = RsD3DMaterialFromME_cOverlayMod.a * output.cColor0.xyz;
- output.cColor1.xyz = RsD3DMaterialFromME_cOverlayMod.xyz + RsD3DMaterialFromME_cOverlayMod.a * output.cColor1.xyz;
- }
- else
- {
- ///All other passes just attenuate the lighting accordingly.
- output.cColor0.xyz = RsD3DMaterialFromME_cOverlayMod.a * output.cColor0.xyz;
- output.cColor1.xyz = RsD3DMaterialFromME_cOverlayMod.a * output.cColor1.xyz;
- }
- return output;
- }
-
- //The Dx7 with explicit textureoperations
- technique D3_FALLBACK_TECHNIQUE_DX7
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(false, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
- ColorOp[0] = MODULATE;
- ColorArg1[0] = DIFFUSE;
- ColorArg2[0] = TEXTURE;
- ColorOp[1] = ADD;
- ColorArg1[1] = CURRENT;
- ColorArg2[1] = SPECULAR;
- ColorOp[2] = DISABLE;
-
- SpecularEnable = false;
- ColorVertex = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_MORELIGHTS
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(false, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
-
- SrcBlend = ONE;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
- ColorOp[0] = MODULATE;
- ColorArg1[0] = DIFFUSE;
- ColorArg2[0] = TEXTURE;
- ColorOp[1] = ADD;
- ColorArg1[1] = CURRENT;
- ColorArg2[1] = SPECULAR;
- ColorOp[2] = DISABLE;
-
- SpecularEnable = false;
- ColorVertex = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(true, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = INVSRCALPHA;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
- ColorOp[0] = MODULATE;
- ColorArg1[0] = DIFFUSE;
- ColorArg2[0] = TEXTURE;
- ColorOp[1] = ADD;
- ColorArg1[1] = CURRENT;
- ColorArg2[1] = SPECULAR;
- ColorOp[2] = DISABLE;
- AlphaOp[0] = SELECTARG1;
- AlphaArg1[0] = DIFFUSE;
- AlphaOp[1] = DISABLE;
-
- SpecularEnable = false;
- ColorVertex = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_MORELIGHTS_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(true, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
- ColorOp[0] = MODULATE;
- ColorArg1[0] = DIFFUSE;
- ColorArg2[0] = TEXTURE;
- ColorOp[1] = ADD;
- ColorArg1[1] = CURRENT;
- ColorArg2[1] = SPECULAR;
- ColorOp[2] = DISABLE;
- AlphaOp[0] = SELECTARG1;
- AlphaArg1[0] = DIFFUSE;
- AlphaOp[1] = DISABLE;
-
- SpecularEnable = false;
- ColorVertex = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- //The Dx7 without explicit texture cascade
- technique D3_FALLBACK_TECHNIQUE_DX7_JUSTALPHA
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(false, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_JUSTALPHA_MORELIGHTS
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(false, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
-
- SrcBlend = ONE;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_JUSTALPHA_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(true, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = INVSRCALPHA;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
- AlphaOp[0] = SELECTARG1;
- AlphaArg1[0] = DIFFUSE;
- AlphaOp[1] = DISABLE;
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_JUSTALPHA_MORELIGHTS_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(true, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
- AlphaOp[0] = SELECTARG1;
- AlphaArg1[0] = DIFFUSE;
- AlphaOp[1] = DISABLE;
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- //The Dx7 without explicit texture cascade
- technique D3_FALLBACK_TECHNIQUE_DX7_NOMADD
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(false, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_NOMADD_MORELIGHTS
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(false, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
-
- SrcBlend = ONE;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_NOMADD_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(true, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = INVSRCALPHA;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_NOMADD_MORELIGHTS_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "35";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7(true, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- // Set texture filtering.
- MinFilter[0] = Linear;
- MagFilter[0] = Linear;
- MipFilter[0] = Point;
-
- // Set texture into stage 0.
- Texture[0] = (RsFALL_DiffuseMap);
-
- SpecularEnable = true;
- ColorVertex = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- struct VS_OUTPUT_SIMPLE_DX7_NOTEX {
- float4 vClipPos: POSITION; //Clipping space position
- float4 cColor0 : COLOR0; //diffuse map mod
- };
-
- VS_OUTPUT_SIMPLE_DX7_NOTEX VS_Fallback_Simple_DX7NOTEX(uniform bool EnableAlpha, uniform bool IsFirstPass, in D3_VERTEXINPUT input)
- {
- VS_OUTPUT_SIMPLE_DX7_NOTEX output;
-
- //Following code outputs position and texture coordinates
- //------------------------------
- output.vClipPos = mul(input.D3_pInputPosition, D3_mObjectToClip); //vertex clip position
- float4 pVertexWorld = mul(input.D3_pInputPosition, D3_mObjectToWorld); //Transform vertex into world position
-
- //Compute light and eye vectors
- //------------------------------
- float3 vToLight = RsFALL_LightPos.xyz - pVertexWorld.xyz;
- float fRealDistToLight = length(vToLight);
- vToLight = normalize(vToLight);
-
- float3 vToEye = normalize(D3_pEye - pVertexWorld);
-
- float4 output_cLightColor = RsD3DComputeLightColor(fRealDistToLight);
-
- //Compute final per vertex color using light/specular/diffuse
- //------------------------------
- float3 vNormal = normalize(mul(input.D3_vInputNormal * RsD3DMaterialFromME_fNormalMod, D3_mObjectToWorldN));
- float3 vRefVec = dot(vToLight, vNormal) * 2 * vNormal - vToLight;
- float fEyeDotRef = max(0, dot(vRefVec, vToEye));
-
- float4 output_cSpecularCol = RsFALL_SpecularColor * pow(fEyeDotRef, RsFALL_Shininess) * RsFALL_SpecularStrength;
- float4 output_cVertexColor = input.D3_cInputColor * RsFALL_VertexColorStrength + RsFALL_DiffuseColor;
-
- float fDiffuseDot = saturate(dot(vNormal, vToLight)) * RsFALL_DiffuseStrength;
- float4 vOutFinal0 = saturate(output_cLightColor * RsFALL_DiffuseMapStrength * fDiffuseDot);
-
- float4 vOutFinal1 = saturate(output_cLightColor * (output_cSpecularCol + (output_cVertexColor * fDiffuseDot)));
- output.cColor0 = vOutFinal0 + vOutFinal1;
- if (EnableAlpha)
- output.cColor0.a = RsD3DMaterialFromME_fOpacity;
-
- ///Add the overlay color
- if (IsFirstPass)
- {
- ///First pass performs complete blending.
- output.cColor0.xyz = RsD3DMaterialFromME_cOverlayMod.xyz + RsD3DMaterialFromME_cOverlayMod.a * output.cColor0.xyz;
- }
- else
- {
- ///All other passes just attenuate the lighting accordingly.
- output.cColor0.xyz = RsD3DMaterialFromME_cOverlayMod.a * output.cColor0.xyz;
- }
-
- return output;
- }
-
- //DX7 technique for HW without textures - all per vertex
- technique D3_FALLBACK_TECHNIQUE_DX7
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "15";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7NOTEX(false, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_MORELIGHTS
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "15";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7NOTEX(false, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
-
- SrcBlend = ONE;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "15";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7NOTEX(true, true);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = INVSRCALPHA;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_DX7_MORELIGHTS_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "15";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple_DX7NOTEX(true, false);
- PixelShader = NULL;
-
- AlphaBlendEnable = true;
- SrcBlend = SRCALPHA;
- DestBlend = ONE;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- //------------------------------
- // This is a fallback code for absolutely weird hardware
- // No texture, just vertex colors
- //------------------------------
- struct VS_OUTPUT_SIMPLE {
- float4 vClipPos: POSITION; //Clipping space position
- float4 cColor : COLOR; //vertex color
- };
-
- VS_OUTPUT_SIMPLE VS_Fallback_Simple(uniform bool IsFirstPass, float4 vPosition : POSITION, float3 vNormal : NORMAL, float4 cColor : COLOR)
- {
- VS_OUTPUT_SIMPLE output;
-
- output.vClipPos = mul(vPosition, D3_mObjectToClip); //vertex clip position
- float4 pVertexWorld = mul(vPosition, D3_mObjectToWorld); //Transform vertex into world position
-
- float3 vLight = normalize(D3_pEye - pVertexWorld);
- vNormal = normalize(mul(vNormal, D3_mObjectToWorldN));
-
- float Diffuse = saturate(dot(vNormal, vLight)) * RsFALL_DiffuseStrength;
- output.cColor = cColor * Diffuse;
- ///Add the overlay color
- if (IsFirstPass)
- {
- ///First pass performs complete blending.
- output.cColor.xyz = RsD3DMaterialFromME_cOverlayMod.xyz + RsD3DMaterialFromME_cOverlayMod.a * output.cColor.xyz;
- }
- else
- {
- ///All other passes just attenuate the lighting accordingly.
- output.cColor.xyz = RsD3DMaterialFromME_cOverlayMod.a * output.cColor.xyz;
- }
- return output;
- }
-
- technique D3_FALLBACK_TECHNIQUE
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "0";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple(true);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = true;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_MORELIGHT
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "opaque";
- string Rs_TechniqueQuality = "0";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple(false);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
-
- ZEnable = true;
- ZFunc = NEVER;
- ZWriteEnable = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_T
- <
- string Rs_TechniqueMode = "firstlight";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "0";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple(true);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
-
- ZEnable = true;
- ZFunc = LESSEQUAL;
- ZWriteEnable = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
- technique D3_FALLBACK_TECHNIQUE_MORELIGHT_T
- <
- string Rs_TechniqueMode = "morelights";
- string Rs_TechniqueOpacity = "transparent";
- string Rs_TechniqueQuality = "0";
- >
- {
- pass D3_FALLBACK_PASS_02
- {
- VertexShader = compile vs_1_1 VS_Fallback_Simple(false);
- PixelShader = NULL;
-
- AlphaBlendEnable = false;
-
- ZEnable = true;
- ZFunc = NEVER;
- ZWriteEnable = false;
-
- Lighting = false;
- ShadeMode = GOURAUD;
-
- CullMode = CCW;
- }
- }
-
-
-